package com.chenxy.common.exception.impl;

import com.chenxy.common.exception.BaseException;

/**
 * 公共异常类
 * @author chenxy
 */
public class CommonException extends Exception implements BaseException {
    private BaseException baseException;

    /**
     * 接受EmBusinessError传参构造业务异常
     * @param baseException
     */
    public CommonException(BaseException baseException){
        super();
        this.baseException = baseException;
    }

    /**
     * 接受EmBusinessError传参构造业务异常,可自定义错误信息
     * @param commonError
     * @param errMsg
     */
    public CommonException(BaseException commonError, String errMsg){
        super();
        this.baseException = commonError;
        this.baseException.setErrMsg(errMsg);
    }

    public int getErrCode() {
        return this.baseException.getErrCode();
    }

    public String getErrMsg() {
        return this.baseException.getErrMsg();
    }

    public BaseException setErrMsg(String errMsg) {
        this.baseException.setErrMsg(errMsg);
        return this;
    }
}
